package cn.brilliantfuture.commentry.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 
 * Title: Communication Entry
 * 
 * Author:  LiTian  
 *
 * Date: 2012-4-26
 * 
 * Description:
 * 
 */
public class CheckMatcher {
	/**
	 * 手机号正则
	 */
	public static final String REGEX_HANDSET_NUMBER = "(^(13[0-9]|15[0-9]|18[0-9])[0-9]{8}$)|(^0[0-9]{10}$)|(^0[0-9]{11}$)|(^0[0-9]{9}$)";
	
	/**
	 * E-MAIL正则
	 */
	//public static final String REGEX_EMAIL = "^([a-z0-9A-Z]+[_-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
	public static final String REGEX_EMAIL = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
	public static boolean check(String str, String regex){
		Pattern pattern = Pattern.compile(regex);
		Matcher matcher = pattern.matcher(str);
		return matcher.matches();
	}
}
